package com.example.mall.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.mall.util.CodeGenerateUtils;

import java.io.Serializable;

/**
 * <p>
 * 商品基本信息表
 * </p>
 *
 * @author whale
 * @since 2025-05-06
 */
@TableName("tb_products")
public class Products extends Model<Products> implements Serializable{

    private static final long serialVersionUID = 1L;

    /**
     * 商品唯一标识
     */
    @TableId("product_id")
    private Long productId;
    /**
     * 商品分类ID
     */
    @TableField("category_id")
    private Long categoryId;
    /**
     * 商品名称
     */
    private String name;
    /**
     * 商品详细描述
     */
    private String description;
    /**
     * 商品原价
     */
    private BigDecimal price;
    /**
     * 商品折扣价（如果有）
     */
    @TableField("discount_price")
    private BigDecimal discountPrice;
    /**
     * 商品库存数量
     */
    private Integer stock;
    /**
     * 是否上架（0：下架，1：上架）
     */
    @TableField("is_active")
    private Integer isActive;
    /**
     * 上架时间
     */
    @TableField("create_date")
    private Date createDate;
    /**
     * 更新时间
     */
    @TableField("update_date")
    private Date updateDate;

    public Products() {
        this.productId = Long.valueOf(CodeGenerateUtils.generateUniqueId());
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getDiscountPrice() {
        return discountPrice;
    }

    public void setDiscountPrice(BigDecimal discountPrice) {
        this.discountPrice = discountPrice;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public Integer getIsActive() {
        return isActive;
    }

    public void setIsActive(Integer isActive) {
        this.isActive = isActive;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    @Override
    public String toString() {
        return "Products{" +
        ", productId=" + productId +
        ", categoryId=" + categoryId +
        ", name=" + name +
        ", description=" + description +
        ", price=" + price +
        ", discountPrice=" + discountPrice +
        ", stock=" + stock +
        ", isActive=" + isActive +
        ", createDate=" + createDate +
        ", updateDate=" + updateDate +
        "}";
    }
}
